home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 007a / ttpmp11.zip / TTPROCS.PAS < prev   
Pascal/Delphi Source File  |  1991-08-29  |  6KB  |  234 lines

  1. Unit ttprocs;
  2.  
  3. Interface
  4. type
  5.         BBSNameType=ARRAY [1..31] OF CHAR;
  6.  
  7.     ConferenceType=RECORD
  8.       ConfSecurityLevel,
  9.       ConfNetMailFlag,
  10.       ConfUserDeleteFlag,
  11.       ConfBackupFlag,
  12.       ConfDaysToKeep:INTEGER;
  13.       ConfDescription:ARRAY [1..41] OF CHAR;
  14.       ConfHighestMessageNumber:LONGINT;
  15.     end;
  16.  
  17.     MessagePointerType=RECORD
  18.       MessageDateTime:ARRAY [1..15] OF CHAR;
  19.             SenderName:BBSNameType;
  20.             MessageToName:BBSNameType;
  21.       MessageSubject:ARRAY [1..41] OF CHAR;
  22.       EchoFlag,
  23.       ThreadFlag,
  24.       PrivateFlag,
  25.       DeletedFlag,
  26.       RCVDFlag:INTEGER;
  27.       MessagePos,
  28.       MessageNumber,
  29.       ResponseTo:LONGINT;
  30.     end;
  31.  
  32.     UserDataType=RECORD
  33.             UserName:BBSNameType;
  34.       UserPassword:ARRAY [1..16] OF CHAR;
  35.       UserCityState:ARRAY [1..31] OF CHAR;
  36.       UserPhoneNumber:ARRAY [1..13] OF CHAR;
  37.       UserDOB:ARRAY [1..9] OF CHAR;
  38.       UserFirstCall:ARRAY [1..9] OF CHAR;
  39.       UserDTLastCall:ARRAY [1..15] OF CHAR;
  40.       RESERVED1:ARRAY [1..9] OF CHAR;
  41.       UserSecurity,
  42.       UserNumberOfCalls,
  43.       UserTimeLeftToday:INTEGER;
  44.       RESERVED2:ARRAY [1..6] OF CHAR;
  45.       UserExpertFlag,
  46.       UserLockoutFlag,
  47.       UserDeleteFlag,
  48.       UserCallsToday,
  49.       RESERVED3:INTEGER;
  50.       UserUploads,
  51.       UserDownloads:LONGINT;
  52.     end;
  53.  
  54. Function FileExists(NameToCheck:STRING):BOOLEAN;
  55. Function GetSize(NameToCheck:STRING):INTEGER;
  56. Procedure AddToPersonalLogOn(UserLogFile:STRING; VAR TempFile:TEXT);
  57. Procedure FixName(NameToFix:BBSNameType; VAR FixedName:STRING);
  58.  
  59. Implementation
  60.  
  61. Function FileExists(NameToCheck:STRING):BOOLEAN;
  62.   var
  63.      TestNewName:FILE;
  64.   begin
  65.        assign(TestNewName,NameToCheck);
  66. {$I-}
  67.        reset(TestNewName,1);
  68. {$I+}
  69.        if IOResult = 0 then
  70.          begin
  71.           FileExists:=True;
  72.           CLOSE(TestNewName);
  73.          end
  74.        else
  75.          begin
  76.            fileExists:=False;
  77.          end;
  78.   end;
  79.  
  80. Function GetSize(NameToCheck:STRING):INTEGER;
  81.   var
  82.      TestNewName:FILE;
  83.   begin
  84.        assign(TestNewName,NameToCheck);
  85. {$I-}
  86.        reset(TestNewName,1);
  87. {$I+}
  88.        if IOResult = 0 then
  89.          begin
  90.           GetSize:=FILESIZE(TESTNEWNAME);
  91.           writeln('Filesize = ',filesize(testnewname) div 1024,' Kb');
  92.           close(TestNewName);
  93.          end
  94.        else
  95.           GetSize:=0;
  96.   end;
  97.  
  98. Procedure AddToPersonalLogOn(UserLogFile:STRING; VAR TempFile:TEXT);
  99.   var
  100.          ExistingFile:TEXT;
  101.          TempBBSFile:TEXT;
  102.          TempANSFile:TEXT;
  103.          NameOfANSFile:STRING;
  104.          NameOfBBSFile:STRING;
  105.      FileDump:STRING;
  106.  
  107.   begin
  108.         NameOfANSFile:=UserLogFile+'.ANS';
  109.         NameOfBBSFile:=UserLogFile+'.BBS';
  110.         IF (FileExists(NameOfANSFile)) or (FileExists(NameOfBBSFile)) THEN
  111.             begin
  112.                 IF FileExists(NameOfANSFile) THEN
  113.                     begin
  114.                         ASSIGN(ExistingFile,NameOfANSFile);
  115.                         ASSIGN(TempANSFile,'TEMP549.TMP');
  116.                         RESET(ExistingFile);
  117.                         REWRITE(TempANSFile);
  118.                         WHILE NOT EOF(ExistingFile) DO
  119.                             begin
  120.                                 READLN(ExistingFile,FileDump);
  121.                                 IF FileDump = '>> TriTel Personal Mail Pager <<' THEN
  122.                                     begin
  123.                                         WHILE FileDump <> '@MORE@' DO
  124.                                             READLN(ExistingFile,FileDump);
  125.                                         READLN(Existingfile,FileDump);
  126.                                     end;
  127.                                 WRITELN(TempANSFile,FileDump);
  128.                             end;
  129.                         CLOSE(ExistingFile);
  130.                         CLOSE(TempANSFile);
  131.                         REWRITE(ExistingFile);
  132.                         RESET(TempFile);
  133.                         WHILE NOT EOF(TempFile) DO
  134.                             begin
  135.                                 READLN(TempFile,FileDump);
  136.                                 WRITELN(ExistingFile,FileDump);
  137.                             end;
  138.                         CLOSE(TempFile);
  139.                         RESET(TempANSFile);
  140.                         WHILE NOT EOF(TempANSFile) DO
  141.                             begin
  142.                                 READLN(TempANSFile,FileDump);
  143.                                 WRITELN(ExistingFile,FileDump);
  144.                             end;
  145.                         CLOSE(ExistingFile);
  146.                         CLOSE(TempANSFile);
  147.                         ERASE(TempANSFile);
  148.                     end;
  149.  
  150.                 IF FileExists(NameOFBBSFile) THEN
  151.                     begin
  152.                         ASSIGN(ExistingFile,NameOfBBSFile);
  153.                         ASSIGN(TempBBSFile,'TEMP549.TMP');
  154.                         RESET(ExistingFile);
  155.                         REWRITE(TempBBSFile);
  156.                         WHILE NOT EOF(ExistingFile) DO
  157.                             begin
  158.                                 READLN(ExistingFile,FileDump);
  159.                                 IF FileDump = '>> TriTel Personal Mail Pager <<' THEN
  160.                                     begin
  161.                                         WHILE FileDump <> '@MORE@' DO
  162.                                             READLN(ExistingFile,FileDump);
  163.                                         READLN(Existingfile,FileDump);
  164.                                     end;
  165.                                 WRITELN(TempBBSFile,FileDump);
  166.                             end;
  167.                         CLOSE(ExistingFile);
  168.                         CLOSE(TempBBSFile);
  169.                         REWRITE(ExistingFile);
  170.                         RESET(TempFile);
  171.                         WHILE NOT EOF(TempFile) DO
  172.                             begin
  173.                                 READLN(TempFile,FileDump);
  174.                                 WRITELN(ExistingFile,FileDump);
  175.                             end;
  176.                         CLOSE(TempFile);
  177.                         RESET(TempBBSFile);
  178.                         WHILE NOT EOF(TempBBSFile) DO
  179.                             begin
  180.                                 READLN(TempBBSFile,FileDump);
  181.                                 WRITELN(ExistingFile,FileDump);
  182.                             end;
  183.                         CLOSE(ExistingFile);
  184.                         CLOSE(TempBBSFile);
  185.                         ERASE(TempBBSFile);
  186.                     end;
  187.             end;
  188.  
  189.         IF NOT FileExists(NameOfBBSFile) THEN
  190.             begin
  191.                 ASSIGN(TempBBSFile,NameOfBBSFile);
  192.                 RESET(TempFile);
  193.                 REWRITE(TempBBSFile);
  194.                 WHILE NOT EOF(TempFile) DO
  195.                     begin
  196.                         READLN(TempFile,FileDump);
  197.                         WRITELN(TempBBSFile,FileDump);
  198.                     end;
  199.                 CLOSE(TempFile);
  200.                 CLOSE(TempBBSFile);
  201.             end;
  202.  
  203.         IF NOT FileExists(NameOfANSFile) THEN
  204.             begin
  205.                 ASSIGN(TempANSFile,NameOfANSFile);
  206.                 RESET(TempFile);
  207.                 REWRITE(TempANSFile);
  208.                 WHILE NOT EOF(TempFile) DO
  209.                     begin
  210.                         READLN(TempFile,FileDump);
  211.                         WRITELN(TempANSFile,FileDump);
  212.                     end;
  213.                 CLOSE(TempFile);
  214.                 CLOSE(TempANSFile);
  215.             end;
  216.  
  217.         ERASE(TempFile);
  218.   end;
  219.  
  220. Procedure FixName(NameToFix:BBSNameType; VAR FixedName:STRING);
  221.     var
  222.         Loop:INTEGER;
  223.  
  224.     begin
  225.         Loop:=1;
  226.         FixedName:='';
  227.         WHILE NameToFix[Loop] <> #0 DO
  228.             begin
  229.                 FixedName:=FixedName+NameToFix[Loop];
  230.                 Loop:=Loop+1;
  231.             end;
  232.     end;
  233.  
  234. end.